# _*_ coding: UTF-8 _*_
# @Time     : 2021/11/4 15:17
# @Author   : 郑鲁明
# @Site     : http://www.hzdledu.cn/
# @File     : case_参数化运行.py
# @Software : PyCharm

import unittest
from selenium import webdriver
from web_d5_pom.page.loging_page import LoginPage
from web_d5_pom.page.main_page import MainPage
from web_d5_pom.common import read_date

class LoginCase(unittest.TestCase):
    def setUp(self) -> None:
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        self.login_page = LoginPage(self.driver)
        self.main_page = MainPage(self.driver)
        self.users = read_date.read_csv1('../data/users.csv')

    def test(self):
        for user in self.users:
            self.driver.get('http://192.168.6.189/cloud/#/open/login')
            self.login_page.input_user(user[0])
            self.login_page.input_password(user[1])
            self.login_page.input_vcode(user[2])
            self.login_page.click_login()

            self.main_page.move_to_icon()
            self.main_page.click_logout()

    def tearDown(self) -> None:
        self.driver.quit()